package zpf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName: ConsumerMovieWithoutEurekaApplication
 * @Description: 电影Ribbon微服务，脱离Eureka使用配置listOfServers进行客户端负载均衡调度
 * * LoadBalanced：该负载均衡注解，已经整合了 Ribbon
 * * Ribbon 的默认负载均衡的算法为：轮询
 * * 配置文件优先级最高，Java代码设置的配置其次，默认的配置优先级最低
 * @Autor: ZPF
 * @Date: 2021/1/13 11:20
 **/
@SpringBootApplication
@EnableEurekaClient
public class ConsumerMovieWithoutEurekaApplication {

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(ConsumerMovieWithoutEurekaApplication.class, args);
        System.out.println("【电影微服务-WithoutEureka定制Ribbon】已启动.");
    }
}